{% if result_hidden_fields %}
    <div class="hiddenfields"> {# DIV for HTML validation #}
        {% for item in result_hidden_fields %}{{ item }}{% endfor %}
    </div>
{% endif %}

{% if results %}
    <div class="result-list">
        <table cellspacing="0">
            <thead>
            <tr>
                {% for header in result_headers %}
                    {% if forloop.counter < 3 %}
                        <th{{ header.class_attrib }}>
                            {% if header.sortable %}
                                {% if header.url %}
                                    <a href="{{ header.url }}">
                                {% else %}
                                    <a href="{{ header.url_primary }}">
                                {% endif %}
                            {% endif %}
                            {{ header.text|capfirst }}
                            {% if header.sortable %}</a>{% endif %}
                        </th>
                    {% else %}
                        <th{{ header.class_attrib }}> {{ header.text|capfirst }}</th>
                    {% endif %}
                {% endfor %}
            </tr>
            </thead>
            <tbody>
            {% for result in results %}
                <tr class="{% cycle 'row1' 'row2' %}">{% for item in result %}{{ item }}{% endfor %}</tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endif %}
